/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Copyright 2002-2003 by Mark Wolgemuth, All rights reserved.             */
/* Copyright 2002-2003 by Employease, Inc.  All rights reserved.           */
/*                                                                         */
/* Redistribution and use in source and binary forms, with or without      */
/* modification, are permitted provided that the following conditions      */
/* are met:                                                                */
/*                                                                         */
/*    1. Redistributions of source code must retain the above copyright    */
/* notice, this list of conditions and the following disclaimer.           */
/*    2. Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in the     */
/* documentation and/or other materials provided with the distribution.    */
/*                                                                         */
/* THIS SOFTWARE IS PROVIDED BY THE MOD_ATHENA PROJECT ``AS IS'' AND ANY   */
/* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE       */
/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR      */
/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR        */
/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,   */
/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,     */
/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR      */
/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY     */
/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT            */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   */
/* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef ATH_CONSTANTS_H
#define ATH_CONSTANTS_H

/* change these defaults if you want */
/* ATH_NAME_MAX = buf len for farm->name, farm->down_url, phys->host, 
 * engine->path, engine->down_url 
 */
#define    ATH_NAME_MAX        256       /* str buf len */        
/* you can set lower soft maxes in apache config directives */
#define    ATH_PHYS_HARDMAX    1024      /* physical counts */
#define    ATH_FARM_HARDMAX    256       /* farm counts */
/* engine feature location */
/* you can shorten these if you like, the first letter */
/* determines the target */
#define    ATH_REQ_JOIN        "&"
#define    ATH_REQ_ARG_JOIN    "?"
#define    ATH_REQ_STATUS      "/status"
#define    ATH_REQ_UPDATE      "/update"
#define    ATH_REQ_BALANCE     "/balance"
#define    ATH_REQ_MIRROR      "/mirror"
#define    ATH_REQ_HELLO       "/hello"
#define    ATH_REQ_FARM        "/farm"
#define    ATH_REQ_PHYS        "/phys"
#define    ATH_REQ_ENGINE      "/engine"
#define    ATH_REQ_DEBUG       "/debug"

/* cookie tokens for smart farm name manipulation */
#define    ATH_SFARM_STR_DELIM_HASH "#"
#define    ATH_SFARM_STR_DELIM     ":"
#define    ATH_SFARM_STR_PREPEND   "prepend"
#define    ATH_SFARM_STR_POSTPEND  "postpend"
#define    ATH_SFARM_STR_REPLACE   "replace"
#define    ATH_SFARM_STR_MATCH     "match"
#define    ATH_SFARM_STR_REGEX     "regex"
#define    ATH_SFARM_STR_STICKY    "sticky"
#define    ATH_SFARM_STR_BLIND     "blindsticky"

/* below here, do not change */

/* the most locks we could possibly need */
#define    ATH_MUXS_HARDMAX    (ATH_PHYS_HARDMAX + ATH_FARM_HARDMAX + 1)

/* read only policies */
#define    ATH_READ_WRITE      0
#define    ATH_READ_ONLY       1

/* shm int arrray flags */
#define    ATH_EOA             -1 /* end of array */
#define    ATH_OPN             -2 /* position has been freed */

#define    ATH_ON              1
#define    ATH_OFF             0
#define    ATH_UP              1
#define    ATH_DOWN            0
#define    ATH_IN              1
#define    ATH_OUT             0

/* for algorithms */
#define    ATH_ALGO_STR_DEFAULT "r" /* used in configuration setup */
#define    ATH_ALGO_FIELDS     16 /* includes null case */
#define    ATH_ALGO_NON        (int)NULL
#define    ATH_ALGO_SNON       "(null)"
#define    ATH_ALGO_CPU        'c' /**/
#define    ATH_ALGO_SCPU       "cpu"
#define    ATH_ALGO_NET        'n'
#define    ATH_ALGO_SNET       "net"
#define    ATH_ALGO_LOD        'l'
#define    ATH_ALGO_SLOD       "ld"
#define    ATH_ALGO_MEM        'm'
#define    ATH_ALGO_SMEM       "mem"
#define    ATH_ALGO_DIS        'd'
#define    ATH_ALGO_SDIS       "disk"
#define    ATH_ALGO_CU0        '0'
#define    ATH_ALGO_SCU0       "0cus"
#define    ATH_ALGO_CU1        '1'
#define    ATH_ALGO_SCU1       "1cus"
#define    ATH_ALGO_CU2        '2'
#define    ATH_ALGO_SCU2       "2cus"
#define    ATH_ALGO_CU3        '3'
#define    ATH_ALGO_SCU3       "3cus"
#define    ATH_ALGO_CU4        '4'
#define    ATH_ALGO_SCU4       "4cus"
#define    ATH_ALGO_CU5        '5'
#define    ATH_ALGO_SCU5       "5cus"
#define    ATH_ALGO_CU6        '6'
#define    ATH_ALGO_SCU6       "6cus"
#define    ATH_ALGO_CU7        '7'
#define    ATH_ALGO_SCU7       "7cus"
#define    ATH_ALGO_CU8        '8'
#define    ATH_ALGO_SCU8       "8cus"
#define    ATH_ALGO_CU9        '9'
#define    ATH_ALGO_SCU9       "9cus"
#define    ATH_ALGO_TYPES      3   /* excludes null case */
#define    ATH_ALGO_ROR        'r' /* round robin */
#define    ATH_ALGO_SIM        's' /* simple */
#define    ATH_ALGO_DYN        'd' /* dynamic */
#define    ATH_ALGO_MAXEX      'm' /* max excluded dyn modifier */ 

/* for update / status case conditions */
#define    ATH_CASE_SPC        ' '
#define    ATH_CASE_ESC        '%'
#define    ATH_CASE_URLESC     'E'
#define    ATH_CASE_F_NAME     'n'
#define    ATH_CASE_ON         'o'
#define    ATH_CASE_UP         'u'
#define    ATH_CASE_IN         'i'
#define    ATH_CASE_ADD_P      'M'
#define    ATH_CASE_REM_P      'R'
#define    ATH_CASE_ALGO       'a'
#define    ATH_CASE_EXPECT     'e'
#define    ATH_CASE_HITADDS    'h'
#define    ATH_CASE_P_HOST     'h'
#define    ATH_CASE_MTIME      't'
#define    ATH_CASE_FMT        'f'
#define    ATH_CASE_DURL       'd'
#define    ATH_CASE_OURL       'D'
#define    ATH_CASE_E_PATH     'P'
#define    ATH_CASE_NOMINA     'n'
#define    ATH_CASE_TTL        't'
#define    ATH_CASE_RTTL       'r'
#define    ATH_CASE_FARM       'f'
#define    ATH_CASE_PHYS       'p'
#define    ATH_CASE_CHOSEN     'c'
#define    ATH_CASE_F_MEMB     'm'
#define    ATH_CASE_P_MEMB     'f'
#define    ATH_CASE_STATS      'S'
#define    ATH_CASE_SERIAL     's'

/* error strings */
/* errors returned in engine reponse */
#define    ATH_EENINVAL        "ERROR: INVALID ENGINE REQUEST\n"
#define    ATH_EENEMPTY        "WARNING: IGNORED EMPTY REQUEST\n"
#define    ATH_EUPINVAL        "WARNING: IGNORED INVALID UPDATE\n"
#define    ATH_ESTINVAL        "WARNING: IGNORED INVALID STATUS\n"
#define    ATH_EMRINVAL        "WARNING: IGNORED INVALID MIRROR\n"
#define    ATH_EBLNFARM        "WARNING: NO FARM SPECIFIED\n"
#define    ATH_EBLEFARM        "WARNING: FARM NOT CONFIGURED\n"
#define    ATH_EBEMFARM        "WARNING: FARM: NO MEMBER AVAILABLE\n"
#define    ATH_ESTIPHYS        "WARNING: IGNORED INVALID PHYS STATUS\n"
#define    ATH_ESTIFARM        "WARNING: IGNORED INVALID FARM STATUS\n"

/* default cookie name for farm name manipulation */

#define    ATH_COOKIE_NAME_SMARTFARM_DEFAULT "X-Ath-Smartfarm"


#endif /* ATH_CONSTANTS_H */
